package com.tang;

import java.util.Scanner;

/**
 * 不爱施肥的小布
 *
 * @author tang
 * @since 2023/5/21 9:22
 */
public class Od002 {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int m = scanner.nextInt(); // 国林的片数
        int n = scanner.nextInt(); // 施肥任务必须在n天完成
        double[] fields = new double[m]; // 国林面积数组
        double totalArea = 0;

        // 首先找到最小的那片，作为K
        double k = fields[0];
        double maxFields = 0d;
        for (int i = 0; i < m; i++) {
            fields[i] = scanner.nextDouble();
            totalArea += fields[i];
            if (k > fields[i]) {
                k = fields[i];
            }
            if (maxFields < fields[i]) {
                maxFields = fields[i];
            }
        }

        for (int i = 0; i < m; i++) {
            
            
            
            
        }

        double minTotalKey = totalArea / n;// 每天最低需需要的K
        if (maxFields < minTotalKey) {
            System.out.print(-1);
        }
        
        
    }
    
}
